local windowList = findWindowList("*","TWNClientFramework");
if( #windowList == 0 ) then
	print("You need to run Rift first!");
	return 0
end

function getWin()
	if( __WIN == nil ) then
  		__WIN = windowList[1]
	end

	return __WIN;
end	

attach(getWin())
setStartKey(key.VK_F5)
setStopKey(key.VK_F6)
local hf_x, hf_y, hf_wide, hf_high = windowRect(getWin())
printf("%d %d %d %d\n", hf_wide, hf_high, hf_x, hf_y)
print("ok starting")
local starttime = os.time()
local tracktime = os.time()
print(os.date())

function main()
	while (true) do
		if os.difftime(os.time(), tracktime) >= 300 then
			print(os.difftime(os.time(), starttime))
			tracktime = os.time()
		end
		keyboardHold(key.VK_A)
		yrest(5000)
		keyboardRelease(key.VK_A)
		yrest(1000)
		keyboardHold(key.VK_D)
		yrest(5000)
		keyboardRelease(key.VK_D)
		yrest(1000)
	end
end

startMacro(main,true)